<template>
  <div class="base_container">
    <el-container>
      <!-- NOTE 侧边栏容器 -->
      <el-aside width="200px">
        <el-menu
          background-color="#b3c0d1"
          active-text-color="red"
          font-size="18"
          text-align = 'center'
          default-active="2"
          class="el-menu-vertical-demo"
          router >
          <el-menu-item v-for="({title, path}, index) in asideList" :key='index' :index="path">
            <span slot="title"> {{ title }} </span>
          </el-menu-item>
        </el-menu>
      </el-aside>

      <el-container>
        <!-- NOTE 主要区域容器 -->
        <el-header> 微前端 - qiankun </el-header>
        <el-main>
          <div id="container">
          </div>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
  import { start, setDefaultMountApp } from 'qiankun'
  export default {
    data() {
      return {
        asideList: [
          {
            title: 'app2',
            path: '/base/app2'
          },
          {
            title: 'app3',
            path: '/base/app3'
          }
        ]
      }
    },
    mounted() {
      if (!window.qiankunStatred) {
        window.qiankunStatred = true
        start()
        setDefaultMountApp('/base/app2')
      }
    }
  }
</script>

<style lang="less">
  * {
    margin: 0;
    padding: 0;
  }

  .el-header, .el-footer {
    background-color: #B3C0D1;
    color: #333;
    text-align: center;
    line-height: 60px;
    padding: 0 !important;
  }
  
  .el-aside {
    height: 100vh;
    background-color: #D3DCE6;
    color: #333;
    text-align: center;
  }
  
  .el-main {
    background-color: #E9EEF3;
    color: #333;
    text-align: center;
    width: calc(100vw - 200px);
    padding: 0 !important;
  }

  #container {
    width: 100%;
    height: calc(100vh - 60px);
  }
</style>
